﻿namespace BM.Tools.WebControls.MForm.Design
{
    using System.ComponentModel;    
    using System.Web.UI;
    using System.Web.UI.Design;

    /// <summary>
    /// This is a class that represents a designer region of a control that has only one template.
    /// </summary>
    public class SingleTemplateControlDesignerRegion : TemplatedEditableDesignerRegion
    {        
        /// <summary>
        /// Initializes a new instance of the <see cref="SingleTemplateControlDesignerRegion"/> class. 
        /// </summary>
        /// <param name="component">
        /// The component.
        /// </param>
        /// <param name="template">
        /// The template.
        /// </param>
        /// <param name="descriptor">
        /// The descriptor.
        /// </param>
        /// <param name="definition">
        /// The definition.
        /// </param>
        public SingleTemplateControlDesignerRegion(
                object component, ITemplate template, PropertyDescriptor descriptor, TemplateDefinition definition)
                : base(definition)
        {
            Template = template;
            Component = component;
            PropertyDescriptor = descriptor;
            EnsureSize = true;
        }
        
        /// <summary>
        /// Gets Component.
        /// </summary>        
        public object Component
        {
            get;
            private set;            
        }

        /// <summary>
        /// Gets PropertyDescriptor.
        /// </summary>
        public PropertyDescriptor PropertyDescriptor
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets Template.
        /// </summary>
        /// <value>
        /// The template.
        /// </value>
        public ITemplate Template
        {
            get;
            set;
        }
    }
}